package com.wc.AlgoOJ_train.train1.c5.A401;

import java.util.HashMap;
import java.util.Scanner;

/**
 * @Author congege
 * @Description 素数判定
 * http://43.138.190.70:8888/p/A401
 * @Date Created in 2024/1/3-15:21
 */
public class Main {
    static int idx = 0;
    static int maxN = 3000;
    static int[] primes = new int[maxN];
    static boolean[] isNotPrime = new boolean[maxN];

    // 欧拉筛
    static void ola(int x) {
        isNotPrime[0] = isNotPrime[1] = true;
        for (int i = 2; i <= x; i++) {
            if (!isNotPrime[i]) {
                primes[++idx] = i;
            }
            for (int j = 1; primes[j] * i <= x; j++) {
                isNotPrime[primes[j] * i] = true;
                if (i % primes[j] == 0) {
                    break;
                }
            }
        }
    }

    public static void main(String[] args) {
        HashMap<Integer, Boolean> map = new HashMap<>();
        Scanner sc = new Scanner(System.in);
        ola(f(50));
        for (int i = -39; i <= 50; i++) {
            map.put(i, isNotPrime[f(i)]);
        }
        while (sc.hasNextInt()) {
            int x = sc.nextInt();
            int y = sc.nextInt();
            if (x == 0 && y == 0) {
                return;
            }
            boolean flg = true;
            for (int i = x; i <= y; i++) {
                if (map.get(i)) {
                    flg = false;
                    break;
                }
            }
            if (flg) {
                System.out.println("OK");
            } else {
                System.out.println("Sorry");
            }
        }
    }

    public static int f(int n) {
        return n * n + n + 41;
    }
}
